package com.daichi.yygh.task.schedule;

import com.daichi.yygh.rabbit.constant.MqConst;
import com.daichi.yygh.rabbit.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class ScheduleTask {

    private final RabbitService rabbitService;

    @Autowired
    public ScheduleTask(RabbitService rabbitService) {
        this.rabbitService = rabbitService;
    }

    // 每天8点执行方法提醒就医
    @Scheduled(cron = "0 0 8 * * ?")
    public void taskPatient() {
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,"");
    }
}
